package com.pfsoft;/**
 * 顺序查找
 *
 * @author PF
 * Created by dell on 2018/6/15.
 */

import com.sun.org.apache.xpath.internal.Arg;

import java.util.Random;

/**
 * com.pfsoft
 * 顺序查找
 * @author PF
 * @create 2018-06-15 11:50
 **/
public class CommonFind {

   public static  void main(String[] args)
    {
        showFoundCharater(3,100);
    }

    public static void showFoundCharater(int x,int size)
    {
        int[] intArray=new int[size];
        Random r=new Random();
        for(int i=0;i<intArray.length;i++)
        {
            intArray[i]=r.nextInt(20);
            System.out.println("第"+i+"个数字为："+intArray[i]);
        }
        for (int j=0;j<intArray.length;j++)
        {
            if(intArray[j]==x)
            {
                System.out.println("找到了,数字为："+x+"地址为："+j);
                break;
            }
        }
        System.out.println("查找完成");
    }
}
